package com.firefly.admin.monitor.controller;

import com.firefly.admin.common.vo.Result;
import com.firefly.admin.monitor.service.FySystemMonitorService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@Api(tags = "定时任务接口API")
@RestController
@RequestMapping("/monitor")
public class FySystemMonitorController {

    @Autowired
    private FySystemMonitorService fySystemMonitorService;

    /**
     * 获取缓存信息
     *
     * @return 缓存信息
     */
    @ApiOperation(value = "获取缓存信息", notes = "获取缓存信息", httpMethod = "GET")
    @PreAuthorize(value = "hasAuthority('monitor:cache')")
    @GetMapping("/cache")
    public Result<Map<String, Object>> getMonitorCacheInfo() {
        return fySystemMonitorService.getMonitorCacheInfo();
    }
}
